<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMembersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('members', function (Blueprint $table) {
            $table->id()->startingValue(54321);
            $table->string('account')->unique()->comment('账号');
            $table->string('password')->comment('密码');
            $table->string('platform', 10)->nullable()->default('wx')->comment('平台');
            $table->string('openid')->unique()->nullable()->comment('openid');
            $table->unsignedBigInteger('default_cashbook_id')->nullable()->comment('默认账本ID');

            $table->string('nick_name')->nullable()->comment('昵称');
            $table->text('avatar')->nullable()->comment('头像');
            $table->tinyInteger('gender')->nullable()->comment('性别');
            $table->string('country')->nullable()->comment('国');
            $table->string('province')->nullable()->comment('省');
            $table->string('city')->nullable()->comment('市');

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('members');
    }
}
